﻿


;获取激活窗口的titile
RAlt & g::showWinInfo()

; alt+t 置顶/取消置顶当前窗口
RAlt & p::pinWin()

;驼峰和下划线命名互转
RAlt & o::humpNameConvert()

;=============以下为具体的实现函数=============

;置顶/取消置顶窗口
pinWin(){
	WinSetAlwaysOnTop -1 , WinExist("a")
}

;展示当前激活窗口信息
showWinInfo(){
	; WinGetActiveTitle Title
	; ControlGetFocus OutputVar , %Title%
	; WinGet  win_id , ID ,%Title%
	; WinGet  win_pid , PID ,%Title%
	; WinGet win_ProcessName , ProcessName ,%Title%
	; WinGet win_ProcessPath , ProcessPath ,%Title%
	; WinGetClass  win_class  ,%Title%
	; Run notepad
	; WinWaitActive ahk_class Notepad
	; SendInput winTile : %Title% {enter}
	; SendInput focusControl : %OutputVar%{enter}
	; SendInput id : %win_id%{enter}
	; SendInput win_pid : %win_pid%{enter}
	; SendInput win_ProcessName : %win_ProcessName%{enter}
	; SendInput win_ProcessPath : %win_ProcessPath%{enter}
	; SendInput win_class : %win_class%{enter}
}

;驼峰命名和下划线命名互转
humpNameConvert(){
	A_Clipboard:=""
	Send "^c"
	ClipWait
	clipValue := A_Clipboard
	
	If InStr(clipValue, "_",1)
	{
		tmpClipValue:=StrLower(clipValue)
		word_array:=StrSplit(tmpClipValue,"_")
		tmpClipValue:=""
		Loop  word_array.Length
		{
			this_word := word_array[A_Index]
			if(A_Index=1){
				tmpClipValue := this_word
			}else{
				tmpFirst := SubStr(this_word,1,1)
				tmpFirst:=StrUpper(tmpFirst)
				other :=SubStr(this_word,2)
				tmpClipValue := tmpClipValue . tmpFirst . other
			}
		}
		A_Clipboard := tmpClipValue
	}else{
	
		strLength := StrLen(clipValue)
		myIndex := 1
		tmpClipValue :=""
		loop   strLength
		{
			tmp := SubStr(clipValue,myIndex,1)
			
			tmp2:=StrLower(tmp)
			if not (tmp2 == tmp)
			{
				tmpClipValue := tmpClipValue . "_" . tmp2
				
			}else{
				tmpClipValue := tmpClipValue . tmp
			}
			
			myIndex := myIndex+1
		}
		A_Clipboard := tmpClipValue
	}
	;msgbox,%clipboard%
	Send "^v"
}